package com.example.stumanager.admin;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

import com.example.stumanager.R;
import com.example.stumanager.database.MessageSql;

import java.util.ArrayList;
import java.util.Collections;

/**
 * 留言信息
 */
public class AdminMessagePage extends AppCompatActivity {
    Button re;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.admin_message_page);
        ListView list=findViewById(R.id.list);
        re = findViewById(R.id.re);
        re.setOnClickListener(view -> finish());
        MessageSql db=new MessageSql(this);
        ArrayList array=db.getAll();
        Collections.reverse(array);
        ArrayAdapter<String> adapter1=new ArrayAdapter<>(AdminMessagePage.this,android.R.layout.simple_list_item_1,array);
        list.setAdapter(adapter1);
    }
}